import { request } from '@/utils'

export const getUserInfo = () => {
  return request.get('/get/user')
}

const MockData = [
  {
    name: 'Tpls',
    title: '模板管理',
    component: 'index',
    path: '/tpls',
    pid: '0',
    id: '1',
    link: '/tpls',
    redirect: '/tpls/edit-tpl',
    icon: 'House',
  },
  {
    name: 'AddTpl',
    title: '添加模板',
    component: 'tpls/tpl1',
    path: 'add-tpl',
    pid: '1',
    id: '1-1',
    link: '/tpls/add-tpl',
    icon: '',
  },
  {
    name: 'EditTpl',
    title: '编辑模板',
    component: 'tpls/tpl2',
    path: 'edit-tpl',
    pid: '1',
    id: '1-2',
    link: '/tpls/edit-tpl',
    icon: '',
  },
  {
    name: 'System',
    title: '用户系统',
    component: 'index',
    path: '/system',
    pid: '0',
    id: '2',
    link: '/system',
    redirect: '/system/add-system',
    icon: 'Message',
  },

  {
    name: 'EditSystem',
    title: '维辑用户',
    component: 'system/test2',
    path: 'edit-system',
    pid: '2',
    id: '2-2',
    link: '/system/edit-system',
    redirect: '/system/edit-system/user-age',
    icon: 'Edit',
  },
  {
    name: 'EditSystemUserInfo',
    title: '信息编辑',
    component: 'system/test3',
    path: 'user-info',
    pid: '2-2',
    id: '2-2-1',
    link: '/system/edit-system/user-info',
    redirect: '',
    icon: '',
  },
  {
    name: 'EditPersonUserInfo',
    title: '个人编辑',
    component: 'system/test4',
    path: 'person-info',
    pid: '2-2',
    id: '2-2-2',
    link: '/system/edit-system/person-info',
    redirect: '',
    icon: '',
  },
  {
    name: 'AddSystem',
    title: '添加用户',
    component: 'system/test1',
    path: 'add-system',
    pid: '2',
    id: '2-1',
    link: '/system/add-system',
    redirect: '',
    icon: '',
  },
  {
    name: 'Cms',
    title: '资讯管理',
    component: 'index',
    path: '/cms',
    pid: '0',
    id: '11',
    link: '/cms',
    redirect: '',
    icon: 'Notification',
  },
  {
    name: 'CmsIndex',
    title: '资讯管理首页',
    component: 'cms/index',
    path: 'index',
    pid: '11',
    id: '11-1',
    link: '/cms/index',
    redirect: '',
    icon: '',
  },
]

// 获取当前用户对应的路由
export const getRouterByUser = () => {
  // return request.post(`${import.meta.env.VITE_API_ADMIN_PATH}/routes`);
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(MockData)
    }, 500)
  })
}
